package org.example.handler;

import lombok.extern.slf4j.Slf4j;
import org.example.util.JsonResult;
import org.example.util.ResultTool;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Auther:Liu
 * @Testname:GlobalExceptionHandler
 * @Date:2025/8/12 14:11
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(value = EmpNotFoundException.class)
    public JsonResult empNotFoundException(Exception e) {
        return ResultTool.fail(201,"emp not found");
    }

    @ExceptionHandler(value = FaildUpdateEmpException.class)
    public JsonResult faildUpdateEmpException(Exception e) {
        return ResultTool.fail(202,"emp not found");
    }
    @ExceptionHandler(value = EmpNotDeleteException.class)
    public JsonResult empNotDeleteException(Exception e) {
        return ResultTool.fail(202,"emp not found");
    }
}
